package ssx.demo.ssxutils.learn;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main {
    public static int count=0;
    public static void main(String[] args) throws Exception{


        ExecutorService threadPool = Executors.newFixedThreadPool(2);

        Product product = new Product();
        Condumer condumer = new Condumer();
        LockDemo lockDemo = new LockDemo();

        threadPool.execute(()->{
            for (int i = 0; i < 100; i++) {
                 product.addSomething(lockDemo);

            }
        });
        threadPool.execute(()->{
            for (int i = 0; i < 100; i++) {
                condumer.delSomething(lockDemo);

            }
        });


        Thread.sleep(3000);
        System.out.println(count);
        threadPool.shutdown();

    }
}
